package net.risesoft.y9.pubsub.message;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 * 通用消息
 *
 * @author dingzhaojun
 * @author qinman
 * @author mengjuhua
 * @date 2022/2/10
 */
public class Y9MessageCommon implements Serializable {
    private static final long serialVersionUID = -1107265840539410276L;

    public static final String TENANT_DATASOURCE_SYNC = "TENANT_DATASOURCE_SYNC";
    public static final String REFRESH_REMOTE_APPLICATION_EVENT = "RefreshRemoteApplicationEvent";

    /** 解决 jackson 序列化丢失类型 */
    @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
    private Serializable eventObject;
    private String eventType;
    private String eventTarget;

    public Y9MessageCommon() {}

    public Y9MessageCommon(Serializable eventObject, String eventType, String eventTarget) {
        this.eventObject = eventObject;
        this.eventType = eventType;
        this.eventTarget = eventTarget;
    }

    public Serializable getEventObject() {
        return eventObject;
    }

    public String getEventTarget() {
        return eventTarget;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventObject(Serializable eventObject) {
        this.eventObject = eventObject;
    }

    public void setEventTarget(String eventTarget) {
        this.eventTarget = eventTarget;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }

    @Override
    public String toString() {
        return "RiseCommonEvent [eventObject=" + eventObject + ", eventType=" + eventType + ", eventTarget=" + eventTarget + "]";
    }

}